package com.mjh.bean;

import java.util.Date;
import com.mjh.util.GravatarUtil;
import org.apache.struts2.json.annotations.JSON;

public class Discuss {
	
	private int id;
	private int discussId;
	private int articleId;
	private String name;
	private String email;
	private String site;
	private String content;
	private Date postTime;
	private String ip;
	private int isReply;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getDiscussId() {
		return discussId;
	}
	public void setDiscussId(int discussId) {
		this.discussId = discussId;
	}
	public int getArticleId() {
		return articleId;
	}
	public void setArticleId(int articleId) {
		this.articleId = articleId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	//得到头像的url
	public String getAvatar(){
		return GravatarUtil.getUrl(this.email);
	}
	public String getContent() {
		if(content != null){
			return content.replaceAll("[\r\n]", "<br>");
		}
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	@JSON(format="yyyy-MM-dd HH:mm")
	public Date getPostTime() {
		return postTime;
	}
	public void setPostTime(Date postTime) {
		this.postTime = postTime;
	}
	public int getIsReply() {
		return isReply;
	}
	public void setIsReply(int isReply) {
		this.isReply = isReply;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getSite() {
		return site;
	}
	public void setSite(String site) {
		this.site = site;
	}
}
